package com.shujia.day17.lambda1;

import java.util.ArrayList;

public class Operator2 {
    public static void main(String[] args) {
        ArrayList<Staff> staffs = new ArrayList<>();
        staffs.add(new Staff("易政", 18, 12000));
        staffs.add(new Staff("李国涛", 19, 20000));
        staffs.add(new Staff("刘俊杰", 13, 8000));
        staffs.add(new Staff("陆玉龙", 12, 6000));

        System.out.println(new Filter().filter(staffs,8000));
    }
    static class Filter {
        public ArrayList<Staff> filter(ArrayList<Staff> staffs, int salary){
            ArrayList<Staff> lessStaff = new ArrayList<>();
            for (Staff staff : staffs) {
                if (staff.salary <= salary){
                    lessStaff.add(staff);
                }
            }
            return lessStaff;
        }
    }
}
